Check and manipulate graph-related properties of an object of class bn
.
# check whether the graph is acyclic/completely directed.
acyclic(x, directed = FALSE, debug = FALSE)
directed(x)
# check whether there is a path between two nodes.
path.exists(x, from, to, direct = TRUE, underlying.graph = FALSE, debug = FALSE)
# deprecated alias of path.exists().
# S4 method for bn
path(object, from, to, direct = TRUE, underlying.graph = FALSE,
debug = FALSE)
# S4 method for bn.fit
path(object, from, to, direct = TRUE,
underlying.graph = FALSE, debug = FALSE)
# build the skeleton or a complete orientation of the graph.
skeleton(x)
pdag2dag(x, ordering)
# build a subgraph spanning a subset of nodes.
subgraph(x, nodes)
an object of class bn
. skeleton()
, acyclic()
,
directed()
, path.exixsts()
and path()
also accept
objects of class bn.fit
.
a character string, the label of a node.
a character string, the label of a node (different from
from
).
a boolean value. If FALSE
ignore any arc between
from
and to
when looking for a path.
a boolean value. If TRUE
the underlying
undirected graph is used instead of the (directed) one from the x
argument.
the labels of all the nodes in the graph; their order is the node ordering used to set the direction of undirected arcs.
the labels of the nodes that induce the subgraph.
a boolean value. If TRUE
only completely directed
cycles are considered; otherwise undirected arcs will also be considered
and treated as arcs present in both directions.
a boolean value. If TRUE
a lot of debugging output is
printed; otherwise the function is completely silent.
acyclic()
, path()
and directed()
return a boolean value.
skeleton()
, pdag2dag()
and subgraph()
return an object of
class bn
.
Bang-Jensen J, Gutin G (2009). Digraphs: Theory, Algorithms and Applications. Springer, 2nd edition.
# NOT RUN {
data(learning.test)
res = gs(learning.test)
acyclic(res)
directed(res)
res = pdag2dag(res, ordering = LETTERS[1:6])
res
directed(res)
skeleton(res)
# }
Run the code above in your browser using DataLab